<?php
class EvaluateNewsAction extends CommonAction {
	public function _initialize(){
		parent::_initialize();
		$this->dao = M('Evaluate');
	}
	
	public function index(){
		$this->listmap = "e.site_id = ".$this->siteid;
        $this->_list('e', "LEFT JOIN __NEWS__ as p on p.id = e.news_id", "p.title,p.img_url as pimg_url,e.*");
		$this->display();
	}
	
	//
	public function edit(){
		$this->list = M('Evaluate_reply') -> where(array('evaluate_id' => $this->_get('id'))) -> order('datetime desc') -> select();
		parent::edit();
	}
	
	public function reply(){
		$this->dao = M('Evaluate_reply');
		$_POST['datetime'] = time();
		$_POST['user_id'] = session(C('USER_AUTH_KEY'));
		parent::insert($_POST, U('edit', array('id' => $this->_post('evaluate_id'))));
	}
}
